<?php

declare(strict_types=1);

namespace Dreamcat\ApiDocTest\TestCases;

use Dreamcat\ApiDoc\Swagger\Define2Swagger;
use PHPUnit\Framework\TestCase;

/**
 * Define2Swagger类测试
 * @author vijay
 */
class Define2SwaggerTest extends TestCase
{
    public function testSetter()
    {
        $tools = new Define2Swagger("test");
        $title = uniqid("title-");
        $version = uniqid("version-");
        $sv = uniqid("sv-");
        $basePath = uniqid("/api/");
        $json = $tools->setBasePath($basePath)
            ->setSwaggerVersion($sv)
            ->setTitle($title)
            ->setVersion($version)
            ->getJson();
        self::assertEquals(
            [
                $basePath,
                $sv,
                $title,
                $version,
            ],
            [
                $json["basePath"],
                $json["swagger"],
                $json["info"]["title"],
                $json["info"]["version"],
            ]
        );
    }
}

# end of file
